﻿@model IEnumerable<TravelWeb.Models.Schedule>
@{
    ViewBag.Title = "Schedule";
}
<h2>
    Schedule</h2>
    
<div class="column1">
    @foreach (var item in Model)
    {
        <table>
            <tr>
                <th>
                    Name
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.ScheduleName)
                </td>
            </tr>
            <tr>
                <th>
                    Tour
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.Tour.TourName)
                </td>
            </tr>
            <tr>
                <th>
                    Transportation
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.Transportation.TransportationName)
                </td>
            </tr>
            <tr>
                <th>
                    Booking deadline
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.ConfirmDate)
                </td>
            </tr>
            <tr>
                <th>
                    Start
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.StartDate)
                </td>
            </tr>
            <tr>
                <th>
                    End
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.EndDate)
                </td>
            </tr>
            <tr>
                <th>
                    Description
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.Description)
                </td>
            </tr>
            <tr>
                <th>
                    People have joined for now
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.numOfCustomer)
                </td>
            </tr>
            <tr>
                <th>
                    Promotion
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.Promotion.PromotionName)
                </td>
            </tr>
            <tr>
                <th>
                    Total passengers allow
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.MaxCustomer)
                </td>
            </tr>
            <tr>
                <th>
                    Status
                </th>
                <td>
                    @Html.DisplayFor(modelItem => item.Status)
                </td>
            </tr>
            <tr>
                <th>
                </th>
                <td>
                    @if (User.IsInRole("Manager"))
                    {
                        if (item.Status.Equals("New"))
                        {
                        @Html.ActionLink("Approve | ", "Approve", new { id = item.ScheduleID });
                        @Html.ActionLink("Edit | ", "Edit", new { id = item.ScheduleID });
                        }
                        @Html.ActionLink("Details | ", "Details", new { id = item.ScheduleID });
                        @Html.ActionLink("Cancel | ", "Delete", new { id = item.ScheduleID });
                    }
                    @if (User.IsInRole("User"))
                    {
                        <a href="/Order/Create?tourID=@item.TourID&scheduleID=@item.ScheduleID&promotionID=@item.PromotionID">
                            Booking</a>
                        @Html.ActionLink("Details", "Details", new { id = item.ScheduleID });
                    }
                </td>
            </tr>
        </table>
        <br />
        <br />
    }
</div>
